{% extends 'admin/bookDeatils.html' %}

{% block title %}添加图书{% endblock %}

{% block search %}
    <form class="navbar-form navbar-right" method="get" action="{{ url_for('bookAdmin.search_book') }}">
        <input type="text" class="form-control" name="kw" placeholder="Search...Books">
        <input type="submit" class="form-control" value="搜索">
    </form>
{% endblock %}

{% block main %}
    <h2 class="sub-header">添加图书</h2>
    <div class="row">
        <form method="POST" enctype="multipart/form-data">

            <div class="col-md-3 text-center">
                <img src="" alt="图书封面" id="show" style="height: 250px">
                <br><br>
                <label class="btn btn-info fileinput-button" for="file">上传图片</label>
                <input type="file" name="img" id="file" onchange="changepic(this)" formenctype="multipart/form-data"
                       accept="image/png, image/jpeg, image/gif, image/jpg">
            </div>
            <div class="col-md-8">
                <br>
                {#            <form class="form-signin" method="post" action="{{ url_for('bookAdmin.editBook') }}">#}
                <div class="input-group">
                    <label for="title" class="input-group-addon">书名：</label>
                    <input id="title" name="title" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">作者：</span>
                    <input type="text" name="author" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <label class="input-group-addon">简介：</label>
                    <textarea class="form-control" rows="3" name="subheading" required></textarea>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">售价：</span>
                    <input type="text" name="price" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">定价：</span>
                    <input type="text" name="price_m" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">库存：</span>
                    <input type="text" name="stock" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">出版社：</span>
                    <input type="text" name="press" class="form-control" required>
                </div>
                <br>
                <div class="input-group">
                    <span class="input-group-addon">出版时间：</span>
                    <input type="date" name="pub_time" class="form-control" required>
                </div>
                <br>
                {#                <div class="input-group">#}
                {#                    <span class="input-group-addon">封面链接：</span>#}
                {#                    <input type="text" name="img_url" class="form-control">#}
                {#                </div>#}
                <br>
                <div>
                    <button type="submit" class="btn btn-primary">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
                    <button type="reset" class="btn btn-info">取消</button>
                    {% for message in get_flashed_messages() %}
                        <div class="flash text-center"><b>{{ message }}</b></div>
                    {% endfor %}
                </div>
            </div>
        </form>
    </div>
{% endblock %}